package com.tac.service.impl;

import com.tac.common.result.Result;
import com.tac.dao.MyTargetDao;
import com.tac.pojo.MyTarget;
import com.tac.service.MyTargetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyTargetServiceImpl implements MyTargetService {

    @Autowired
    private MyTargetDao myTargetDao;

    public Result<List<MyTarget> > getList(){
        List<MyTarget> list = myTargetDao.getList();
        return Result.success(list);
    }

    public Result update(MyTarget myTarget){
        Integer integer = myTargetDao.update(myTarget);
        if(integer>0){
            return Result.success(null);
        }
        return Result.error("更新失败");
    }

    public Result remove(List<Integer> ids){
        Integer integer = myTargetDao.remove(ids);
        if(integer>0){
            return Result.success(null);
        }
        return Result.error("删除失败");
    }

    public Result save(MyTarget myTarget){
        Integer integer = myTargetDao.save(myTarget);
        if(integer>0){
            return Result.success(myTarget);
        }
        return Result.error("添加失败");
    }
}
